package com.moleq.device.printer;

import java.util.ArrayList;
import java.util.List;

public abstract class MingColection<T> {

	protected List<T> records = new ArrayList<T>();

	public void add(T obj) {
		records.add(obj);
	}
	
	
	public void remove(int location){
		records.remove(location);
	}
	
	public void remove(T obj){
		records.remove(obj);
	}

	public void clear() {
		records.clear();
	}

	public int count() {
		return records.size();
	}

	public T get(int location) {
		if (records != null && records.size() > location) {
			return records.get(location);
		}
		return null;
	}

	public abstract T find(Object key);

	public boolean contains(T obj){
		boolean result = false;
		if (records.contains(obj)) {
			result = true;
		}
		return result;
	}
}
